'use strict';
import React from 'react';
import { StyleSheet, Text, SectionList,View,Image,} from 'react-native';
import {Flex,Grid , Accordion, List } from 'antd-mobile'

export default class MyTree extends React.Component {
    constructor(props){
        super(props);
        this.state = { detailTitle:'aaaa'};
    }
    _pressItem(){
        console.log(this)
    }
    getChildren(data){

    }
    renderTreeNodes(treeNodes){
        return treeNodes.map((item) => {
            if (item.children) {
                return (
                    <List  style={{padding: 1}}>
                        <List.Item arrow="horizontal"  onClick={() => this.getChildren(item.children)}>{item.title}</List.Item>
                        <List.Item>{this.renderTreeNodes(item.children)}</List.Item>
                    </List>
                );
            }
            return <List>
                        <List.Item arrow="down" onClick={() => {}}>{item.title}</List.Item>
                    </List>;
        });
    }
    render(){
        return(
           <View style={{padding: 20}}>
               {this.renderTreeNodes(this.props.item)}
           </View>
        )
    }
}